/*
 * tarm_iic.h
 *
 *  Created on: 2019��10��26��
 *      Author: AN
 */

#ifndef SRC_MIDDLEWARE_TARM_IO_H_
#define SRC_MIDDLEWARE_TARM_IO_H_

#include "gpio.h"

//PORT
//#define X_STP_P 0
//#define Y_STP_P 1
//#define Z_STP_P 1

//#define X_DIR_P 1
//#define Y_DIR_P 1
//#define Z_DIR_P 1

//#define EN_STEER_P 1

//#define X_LIM_P 1
//#define Y_LIM_P 1

//gpio
#define X_STP_PORT PC
#define Y_STP_PORT PC
#define Z_STP_PORT PC

#define X_DIR_PORT PC
#define Y_DIR_PORT PC
#define Z_DIR_PORT PC

#define EN_STEER_PORT PE

#define X_LIM_PORT PC
#define Y_LIM_PORT PC

//PIN
#define X_STP_PIN BIT0
#define Y_STP_PIN BIT1
#define Z_STP_PIN BIT2

#define X_DIR_PIN BIT3
#define Y_DIR_PIN BIT4
#define Z_DIR_PIN BIT5

#define EN_STEER_PIN BIT0

#define X_LIM_PIN BIT6
#define Y_LIM_PIN BIT7

//gpio-NUM
#define X_STP_PORNUM 2
#define Y_STP_PORNUM 2
#define Z_STP_PORNUM 2

#define X_DIR_PORNUM 2
#define Y_DIR_PORNUM 2
#define Z_DIR_PORNUM 2

#define EN_STEER_PORNUM 4

#define X_LIM_PORNUM 2
#define Y_LIM_PORNUM 2

//PIN-NUM
#define X_STP_PINUM 0
#define Y_STP_PINUM 1
#define Z_STP_PINUM 2

#define X_DIR_PINUM 3
#define Y_DIR_PINUM 4
#define Z_DIR_PINUM 5

#define EN_STEER_PINUM 0

#define X_LIM_PINUM 6
#define Y_LIM_PINUM 7

//SET
#define X_STP_SET GPIO_PIN_DATA(X_STP_PORNUM, X_STP_PINUM)=1
#define Y_STP_SET GPIO_PIN_DATA(Y_STP_PORNUM, Y_STP_PINUM)=1
#define Z_STP_SET GPIO_PIN_DATA(Z_STP_PORNUM, Z_STP_PINUM)=1

#define X_DIR_SET GPIO_PIN_DATA(X_DIR_PORNUM, X_DIR_PINUM)=1
#define Y_DIR_SET GPIO_PIN_DATA(Y_DIR_PORNUM, Y_DIR_PINUM)=1
#define Z_DIR_SET GPIO_PIN_DATA(Z_DIR_PORNUM, Z_DIR_PINUM)=1

#define EN_STEER_SET GPIO_PIN_DATA(EN_STEER_PORNUM, EN_STEER_PINUM)=1

//RESET
#define X_STP_RESET GPIO_PIN_DATA(X_STP_PORNUM, X_STP_PINUM)=0
#define Y_STP_RESET GPIO_PIN_DATA(Y_STP_PORNUM, Y_STP_PINUM)=0
#define Z_STP_RESET GPIO_PIN_DATA(Z_STP_PORNUM, Z_STP_PINUM)=0

#define X_DIR_RESET GPIO_PIN_DATA(X_DIR_PORNUM, X_DIR_PINUM)=0
#define Y_DIR_RESET GPIO_PIN_DATA(Y_DIR_PORNUM, Y_DIR_PINUM)=0
#define Z_DIR_RESET GPIO_PIN_DATA(Z_DIR_PORNUM, Z_DIR_PINUM)=0

#define EN_STEER_RESET GPIO_PIN_DATA(EN_STEER_PORNUM, EN_STEER_PINUM)=0

//GET
#define X_LIM GPIO_PIN_DATA(X_LIM_PORNUM, X_LIM_PINUM)
#define Y_LIM GPIO_PIN_DATA(Y_LIM_PORNUM, Y_LIM_PINUM)

/************ function **************/
void SteeringIO_Init(void);

#endif /* SRC_MIDDLEWARE_TARM_IIC_H_ */
